package main.java.org.itc4.Presentacion;

import java.util.ArrayList;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;

import main.java.org.itc4.Dominio.Tarea;
import main.java.org.itc4.Control.Gestor_Tarea;

public class Interfaz_Tarea   extends ActionSupport{
	public Gestor_Tarea _unnamed_Gestor_Tarea_;
	
	private List<Tarea> tareaList = new ArrayList<Tarea>();
	
	private Tarea filtro = new Tarea();
	
	/**
	 * @return the tareaList
	 */
	public List<Tarea> getTareaList() {
		return tareaList;
	}



	/**
	 * @param tareaList the tareaList to set
	 */
	public void setTareaList(List<Tarea> tareaList) {
		this.tareaList = tareaList;
	}



	/**
	 * @return the filtro
	 */
	public Tarea getFiltro() {
		return filtro;
	}



	/**
	 * @param filtro the filtro to set
	 */
	public void setFiltro(Tarea filtro) {
		this.filtro = filtro;
	}
	
public String execute() {
		
		String a = "casa";
		Gestor_Tarea gestor = new Gestor_Tarea();
		//tareaList = gestor.buscarTarea();
		final Tarea t1 = new Tarea();
		t1.set_id(1);
		t1.set_autor("pepe");
		t1.set_nombre("Comprar pan");
		t1.set_completada(false);
		final Tarea t2 = new Tarea();
		t2.set_id(2);
		t2.set_autor("juan");
		t2.set_nombre("Comprar harina");
		t2.set_completada(false);
		final Tarea t3 = new Tarea();
		t3.set_id(3);
		t3.set_autor("juan");
		t3.set_nombre("Comprar pizzas");
		t3.set_completada(false);
		if(filtro.get_autor().isEmpty() || filtro.get_autor().equals("pepe")){
			tareaList.add(t1);	
		}else{
			tareaList.add(t2);
			tareaList.add(t3);	
		}		
		
		//if(validar){
		return SUCCESS;
		//}else{
		//	return ERROR;
		//}
	
}
	
}